package moder

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(100)"`
	Password string `gorm:"type:varchar(100)"`
}

func (u *User) UserAdd(db *gorm.DB) error {
	return db.Create(u).Error
}

func (u *User) UserDel(db *gorm.DB, id int64) error {
	return db.Where("id=?", id).Delete(u).Error
}

func (u *User) UserUpdate(db *gorm.DB, id int64) error {
	return db.Where("id=?", id).Updates(u).Error
}
